package com.javacoo.junit.generator.config;

import java.util.List;

import static com.javacoo.junit.generator.internal.util.StringUtility.stringHasValue;
import static com.javacoo.junit.generator.internal.util.messages.Messages.getString;
/**
 * 模板配置对象
 * <p>说明:</p>
 * <li></li>
 * @author duanyong@jccfc.com
 * @date 2021/1/1 9:08
 */
public class TemplateConfiguration extends PropertyHolder {
    /**
     * 模板路径
     */
    private String templatePath;
    /**
     * 模板名称
     */
    private String templateName;
    /**
     * 模板处理器名称
     */
    private String templateHandlerName;

    public TemplateConfiguration() {
        super();
    }

    public String getTemplatePath() {
        return templatePath;
    }

    public void setTemplatePath(String templatePath) {
        this.templatePath = templatePath;
    }

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public String getTemplateHandlerName() {
        return templateHandlerName;
    }

    public void setTemplateHandlerName(String templateHandlerName) {
        this.templateHandlerName = templateHandlerName;
    }

    public void validate(List<String> errors, String contextId) {
        if (!stringHasValue(templatePath)) {
            errors.add(getString("ValidationError.2", contextId));
        }

        if (!stringHasValue(templateName)) {
            errors.add(getString("ValidationError.12", "templates", contextId));
        }
    }
}
